﻿/*
·--------------------------------------------------------------------·
| TranslatorAddin - ThisAddIn                                        |
| Copyright (c) 2010, Ben Chege.                                     |
| http://code.google.com/p/translatoraddin                           |
·--------------------------------------------------------------------·
| This software is free software; you can redistribute it and/or     |
| modify it under the terms of the GNU Lesser General Public         |
| License as published by the Free Software Foundation; either       |
| version 2.1 of the License, or (at your option) any later version. |
|                                                                    |
| This software is distributed in the hope that it will be useful,   |
| but WITHOUT ANY WARRANTY; without even the implied warranty of     |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  |
| Lesser General Public License for more details.                    |
|                                                                    |
| GNU LGPL: http://www.gnu.org/copyleft/lesser.html                  |
·--------------------------------------------------------------------·
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Word = Microsoft.Office.Interop.Word;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Tools.Word;
using Microsoft.Office.Tools;
using TranslatorAddin.TaskPane;
using Google.API.Translate;

namespace WordTranslatorAddin
{
    public partial class ThisAddIn
    {
        private CustomTaskPane taskPane;

        internal CustomTaskPane TaskPane
        {
            get
            {
                return this.taskPane;
            }
        }


        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {

            var taskPaneHost = new TaskPaneHost();
            var view = taskPaneHost.View;

            var translatorViewModel = new TranslatorViewModel(Language.TranslatableCollection);
            taskPaneHost.View.DataContext = translatorViewModel;
            this.taskPane = this.CustomTaskPanes.Add(taskPaneHost, "Translator");
            this.taskPane.Visible = true;
            this.taskPane.Width = 222;
            translatorViewModel.DetectFromLanguage();
        }

        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
            //this.BeginInitialization();
        }

        #region VSTO generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InternalStartup()
        {
            this.Startup += new System.EventHandler(ThisAddIn_Startup);
            this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
        }
        
        #endregion
    }
}
